hvmloader: Formatting cleanups.
authorKeir Fraser <keir@xen.org>
Mon, 25 Jul 2011 13:09:41 +0000 (14:09 +0100)
committerKeir Fraser <keir@xen.org>
Mon, 25 Jul 2011 13:09:41 +0000 (14:09 +0100)
Signed-off-by: Keir Fraser <keir@xen.org>
tools/firmware/hvmloader/e820.c
tools/firmware/hvmloader/hvmloader.c
tools/firmware/hvmloader/mp_tables.c
tools/firmware/hvmloader/pir.c
tools/firmware/hvmloader/rombios.c
tools/firmware/hvmloader/seabios.c
tools/firmware/hvmloader/smbios.c
tools/firmware/hvmloader/util.h

index 31848568427491a4497de3a5934c3b484b048a6b..8e68e8c9a3de26ee949cb30f26b8d8d404f831f3 100644 (file)
@@ -91,7 +91,8 @@ int build_e820_table(struct e820entry *e820,
 
     ASSERT ( bios_image_base < 0x100000 );
 
-    if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS ) {
+    if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS )
+    {
         /*
          * 0x0-lowmem_reserved_base: Ordinary RAM.
          */
index d7b8078b009ccc386a5115406be72325dc4b481d..4613a736f4f79dec7e20a53e677ec097c3b4e8a5 100644 (file)
@@ -408,23 +408,24 @@ int main(void)
 
     perform_tests();
 
-    if (bios->bios_info_setup)
+    if ( bios->bios_info_setup )
         bios->bios_info_setup();
 
-    if (bios->create_smbios_tables) {
+    if ( bios->create_smbios_tables )
+    {
         printf("Writing SMBIOS tables ...\n");
         bios->create_smbios_tables();
     }
 
-    if (bios->bios_load) {
+    printf("Loading %s ...\n", bios->name);
+    if ( bios->bios_load )
         bios->bios_load(bios);
-    } else {
-        printf("Loading %s ...\n", bios->name);
+    else
         memcpy((void *)bios->bios_address, bios->image,
                bios->image_size);
-    }
 
-    if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) {
+    if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
+    {
         if ( bios->create_mp_tables )
             bios->create_mp_tables();
         if ( bios->create_pir_tables )
@@ -476,14 +477,16 @@ int main(void)
             .value = 1,
         };
 
-        if ( bios->acpi_build_tables ) {
+        if ( bios->acpi_build_tables )
+        {
             printf("Loading ACPI ...\n");
             bios->acpi_build_tables();
         }
+
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 
-    if (bios->vm86_setup)
+    if ( bios->vm86_setup )
         bios->vm86_setup();
 
     cmos_write_memory_size();
@@ -508,10 +511,10 @@ int main(void)
            bios->bios_address,
            bios->bios_address + bios->image_size - 1);
 
-    if (bios->e820_setup)
+    if ( bios->e820_setup )
         bios->e820_setup();
 
-    if (bios->bios_info_finish)
+    if ( bios->bios_info_finish )
         bios->bios_info_finish();
 
     xenbus_shutdown();
index ee88db59651460cc32fa7659d2ae76996cdd9b52..2960627714f99c9efc7d42444092c4d53e0df96c 100644 (file)
@@ -211,7 +211,8 @@ static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 
 
 /* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
-static void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
+static void fill_mp_bus_entry(
+    struct mp_bus_entry *mpbe, int bus_id, const char *type)
 {
     int i;
 
@@ -272,7 +273,8 @@ unsigned long create_mp_tables(void *_mpfps)
 
     printf("Creating MP tables ...\n");
 
-    if (!_mpfps) {
+    if ( _mpfps == NULL )
+    {
         int sz;
 
         sz  = sizeof(struct mp_floating_pointer_struct);
@@ -282,7 +284,7 @@ unsigned long create_mp_tables(void *_mpfps)
         sz += sizeof(struct mp_ioapic_entry);
         sz += sizeof(struct mp_io_intr_entry) * 16;
 
-        base = mem_alloc(sz, 0);
+        _mpfps = mem_alloc(sz, 0);
     }
 
     mpfps = _mpfps;
index 2d265da195fc00207b4ebd60924200d8bc8f72d7..893718c9dbc8c769d6f32aa4fffc754db4bfadd5 100644 (file)
@@ -23,7 +23,8 @@
  */
 unsigned long create_pir_tables(void)
 {
-    int length = sizeof(struct pir_table) + sizeof(struct pir_slot)*NR_PIR_SLOTS;
+    int length = sizeof(struct pir_table)
+        + sizeof(struct pir_slot) * NR_PIR_SLOTS;
     struct pir_table *pir = scratch_alloc(length, 0);
     int i, checksum;
 
@@ -57,10 +58,8 @@ unsigned long create_pir_tables(void)
     }
 
     checksum = 0;
-    for ( i = 0; i < length; i++)
-    {
+    for ( i = 0; i < length; i++ )
         checksum += ((int8_t *)pir)[i];
-    }
     pir->checksum = -checksum;
 
     return (unsigned long)pir;
index 632ab87c4502c222dd4850137571003ff7ddb257..ba2718f2daea14b7ee0077024198643b3aa16262 100644 (file)
@@ -86,7 +86,6 @@ static void rombios_load(const struct bios_config *config)
     uint32_t bioshigh;
     struct rombios_info *info;
 
-    printf("Loading %s ...\n", config->name);
     memcpy((void *)config->bios_address, config->image,
            config->image_size);
 
@@ -110,7 +109,7 @@ static void *get_mp_table_start(void)
           bios_mem != (char *)ROMBIOS_END;
           bios_mem++ )
     {
-        if ( strncmp(bios_mem, "___HVMMP", 8) == 0)
+        if ( strncmp(bios_mem, "___HVMMP", 8) == 0 )
             return bios_mem;
     }
 
@@ -124,7 +123,7 @@ static void reset_bios_checksum(void)
     uint8_t checksum;
 
     checksum = 0;
-    for (i = 0; i < ROMBIOS_MAXOFFSET; ++i)
+    for ( i = 0; i < ROMBIOS_MAXOFFSET; i++ )
         checksum += ((uint8_t *)(ROMBIOS_BEGIN))[i];
 
     *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
@@ -153,9 +152,10 @@ static void rombios_create_mp_tables(void)
 
 static void rombios_create_smbios_tables(void)
 {
-    hvm_write_smbios_tables(SMBIOS_PHYSICAL_ADDRESS,
-                            SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
-                            SMBIOS_PHYSICAL_END);
+    hvm_write_smbios_tables(
+        SMBIOS_PHYSICAL_ADDRESS,
+        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+        SMBIOS_PHYSICAL_END);
 }
 
 //BUILD_BUG_ON(sizeof(rombios) > (0x00100000U - ROMBIOS_PHYSICAL_ADDRESS));
index e1ce5552d1bd76aa434948f0f2155cc262a49431..c63387541581846dc2a0120aa5670ea4d97d5377 100644 (file)
@@ -71,7 +71,7 @@ static void seabios_finish_bios_info(void)
     uint8_t checksum;
 
     checksum = 0;
-    for (i = 0; i < info->length; ++i)
+    for ( i = 0; i < info->length; i++ )
         checksum += ((uint8_t *)(info))[i];
 
     info->checksum = -checksum;
index cfc85957071949254493726878bbd02124d06989..5674bf42c05c57b5e4fca684e8746b288442039d 100644 (file)
@@ -77,9 +77,9 @@ get_cpu_manufacturer(char *buf, int len)
     cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
           (uint32_t *)&id[4]);
 
-    if (memcmp(id, "GenuineIntel", 12) == 0)
+    if ( memcmp(id, "GenuineIntel", 12) == 0 )
         strncpy(buf, "Intel", len);
-    else if (memcmp(id, "AuthenticAMD", 12) == 0)
+    else if ( memcmp(id, "AuthenticAMD", 12) == 0 )
         strncpy(buf, "AMD", len);
     else
         strncpy(buf, "unknown", len);
@@ -158,7 +158,8 @@ get_memsize(void)
 }
 
 void
-hvm_write_smbios_tables(unsigned long ep, unsigned long smbios_start, unsigned long smbios_end)
+hvm_write_smbios_tables(
+    unsigned long ep, unsigned long smbios_start, unsigned long smbios_end)
 {
     xen_domain_handle_t uuid;
     uint16_t xen_major_version, xen_minor_version;
@@ -232,7 +233,8 @@ hvm_write_smbios_tables(unsigned long ep, unsigned long smbios_start, unsigned l
 
     memcpy((void *)smbios_start, (void *)scratch_start, len);
 
-    smbios_entry_point_init((void *)ep, max_struct_size, len, smbios_start, nr_structs);
+    smbios_entry_point_init(
+        (void *)ep, max_struct_size, len, smbios_start, nr_structs);
 
     return;
 
@@ -313,12 +315,14 @@ smbios_type_0_init(void *start, const char *xen_version,
     p->embedded_controller_minor = 0xff;
 
     start += sizeof(struct smbios_type_0);
-    if ((s = xenstore_read("bios-strings/bios-vendor")) == NULL || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/bios-vendor")) == NULL)
+         || (*s == '\0') )
         s = "Xen";
     strcpy((char *)start, s);
     start += strlen(s) + 1;
 
-    if ((s = xenstore_read("bios-strings/bios-version")) == NULL || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/bios-version")) == NULL)
+         || (*s == '\0') )
         s = xen_version;
     strcpy((char *)start, s);
     start += strlen(s) + 1;
@@ -358,27 +362,27 @@ smbios_type_1_init(void *start, const char *xen_version,
 
     start += sizeof(struct smbios_type_1);
     
-    if ((s = xenstore_read("bios-strings/system-manufacturer")) == NULL  
-        || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/system-manufacturer")) == NULL)
+         || (*s == '\0') )
         s = "Xen";
     strcpy((char *)start, s);
     start += strlen(s) + 1;
 
-    if ((s = xenstore_read("bios-strings/system-product-name")) == NULL
-         || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/system-product-name")) == NULL)
+         || (*s == '\0') )
         s = "HVM domU";
     strcpy((char *)start, s);
     start += strlen(s) + 1;
 
-    if ((s = xenstore_read("bios-strings/system-version")) == NULL
-        || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/system-version")) == NULL)
+         || (*s == '\0') )
         s = xen_version;
     strcpy((char *)start, s);
     start += strlen(s) + 1;
 
     uuid_to_string(uuid_str, uuid); 
-    if ((s = xenstore_read("bios-strings/system-serial-number")) == NULL
-        || *s == '\0')
+    if ( ((s = xenstore_read("bios-strings/system-serial-number")) == NULL)
+         || (*s == '\0') )
         s = uuid_str;
     strcpy((char *)start, s);
     start += strlen(s) + 1;
@@ -486,10 +490,11 @@ smbios_type_11_init(void *start)
     start += sizeof(struct smbios_type_11);
 
     /* Pull out as many oem-* strings we find in xenstore */
-    for (i = 1; i < 100; i++) {
+    for ( i = 1; i < 100; i++ )
+    {
         path[(sizeof path) - 3] = '0' + ((i < 10) ? i : i / 10);
         path[(sizeof path) - 2] = (i < 10) ? '\0' : '0' + (i % 10);
-        if ((s = xenstore_read(path)) == NULL || *s == '\0')
+        if ( ((s = xenstore_read(path)) == NULL) || (*s == '\0') )
             break;
         strcpy((char *)start, s);
         start += strlen(s) + 1;
@@ -497,7 +502,8 @@ smbios_type_11_init(void *start)
     }
     
     /* Make sure there's at least one type-11 string */
-    if (p->count == 0) {
+    if ( p->count == 0 )
+    {
         strcpy((char *)start, "Xen");
         start += strlen("Xen") + 1;
         p->count++;
index e000874ec4cecc42aee25869bdb787d0b0d81c2e..bc86043eec9a3a0f97b6a75634e28fd133a80c7b 100644 (file)
@@ -199,9 +199,8 @@ uint32_t rombios_highbios_setup(void);
 /* Miscellaneous. */
 void cacheattr_init(void);
 unsigned long create_mp_tables(void *table);
-void hvm_write_smbios_tables(unsigned long ep,
-                             unsigned long smbios_start,
-                             unsigned long smbios_end);
+void hvm_write_smbios_tables(
+    unsigned long ep, unsigned long smbios_start, unsigned long smbios_end);
 unsigned long create_pir_tables(void);
 
 void smp_initialise(void);